package com.ccc.controller;

import com.ccc.entity.User;
import com.ccc.service.LoginService;
import com.ccc.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    /**
     * 用户登录接口
     * @param user
     * @return
     */
    @PostMapping("/user/login")
    public ResponseResult login(@RequestBody User user) {

        return loginService.login(user);
    }

    /**
     * 用户等出
     * @return
     */
    @RequestMapping("/user/logout")
    public ResponseResult logout() {
        // 退出登录
        return loginService.logout();
    }

}
